import { legacy_createStore as createStore } from 'redux'

const initState = {
	count: 1
}

const reducer = (state = initState, action: any) => {
	switch (action.type) {
		case 'add': {
			return {
				count: state.count + action.payload
			}
		}
		default: return state
	}
}

const store = createStore(reducer)

const state = store.getState()
console.log(state)

const action = { type: 'add', payload: 10 }



store.dispatch(action)


const state1 = store.getState()
console.log(state1)

store.dispatch(action)

const state2 = store.getState()
console.log(state2)



export default store